//
//  GetYearMonthDay.m
//  微密
//
//  Created by wemeDev on 14/12/31.
//  Copyright (c) 2014年 longlz. All rights reserved.
//

#import "GetYearMonthDay.h"

@implementation GetYearMonthDay

+ (NSString*)getYearMonthAndDay
{
    NSDateFormatter * formater = [[NSDateFormatter alloc]init];
    [formater setDateStyle:NSDateFormatterShortStyle];
    NSString * str = [formater stringFromDate:[NSDate date]];
    NSArray * array = [str componentsSeparatedByString:@"/"];
    NSString * str1 = [array objectAtIndex:0];
    NSString * str2 = [array objectAtIndex:1];
    NSString * str3 = [array objectAtIndex:2];
    NSString * dateStr = [NSString stringWithFormat:@"20%@%@%@",str3,str1,str2];
    return dateStr;
}

+ (NSString*)getYearMonthAndDayAction
{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    //设定时间格式,这里可以设置成自己需要的格式
    [dateFormatter setDateFormat:@"yyyyMMdd"];
    //用[NSDate date]可以获取系统当前时间
    NSString *currentDateStr = [dateFormatter stringFromDate:[NSDate date]];
    return currentDateStr;
}

@end
